<?php
/************************
 *  Codenova.pl Project
 *  Created by: Kamil Mrzygłód
 *
 *  (c) 2013 by Codenova.pl
 *  All Right Reserved
 ***********************/

namespace Gotcha\App\Extensions;

use Gotcha\App\Types\Arrays;
use Gotcha\App\Types\Bool;
use Gotcha\App\Types\Int;
use GotchaDatabase\GotchaThemesQuery;
use Gotcha\App\Types\String;

// Gotcha themes

final class ViewsExtension extends HtmlExtension {
    // Field contains name of the current
    // view file connected with called
    // controller;
    public $moduleViewFile;

    // Private fields
    private $currentThemeName = 'SafeMode'; // Default active theme
    private $accepted_methods = array('Display', 'ActionLink', 'HtmlLabel', 'HtmlTextBox', 'HtmlRadio', 'HtmlCheckbox', 'HtmlBeginForm'); // Accepted methods

    // Private static fields
    private static $currentThemeNameStatic = 'SafeMode';

    public function __set($name, $value) {
        // We use setter to dynamically set values
        // and variables, which are supposed to be passed
        // to a view
        $this->$name = $value;
    }

    public function __construct() {
        // We load a name of current theme to set further view
        $themes = new GotchaThemesQuery();
        $activeTheme = $themes->create()->filterByIsActive(1)->findOne();

        // None of the themes can be activated so we have to
        // take care of this situation by enabling SafeMode
        if(empty($activeTheme) || !isset($activeTheme) || is_null($activeTheme)) {
            $this->currentThemeName = 'SafeMode';
            self::$currentThemeNameStatic = 'SafeMode';
        } else {
            // We also have to make sure theme dir exists
            if (FileSystemExtension::CheckDirExistence(new String(GOTCHA_ROOT_DIR.'/Themes/'.$activeTheme)) && !is_null($activeTheme)) {
                $this->currentThemeName = $activeTheme;
                self::$currentThemeNameStatic = $activeTheme;
            } else {
                LogsExtension::createNewLogEntry(new String('THEME_DIR_DOESNT_EXIST'), new Arrays(array($activeTheme)));
                $this->currentThemeName = 'SafeMode';
                self::$currentThemeNameStatic = 'SafeMode';
            }
        }
    }
	
	// Views extension method overloader
	public function __call($method, $params) {
		if(in_array($method, $this->accepted_methods)) {
            switch($method) {
                case 'Display':
                    switch(count($params)) {
                        case 1:
                            switch(gettype($params[0])) {
                                case 'string':
                                    $this->Display1String(new String($params[0]));
                                    break;
                                case 'array':
                                    $this->Display1Array(new Arrays($params[0]));
                                    break;
                                default:
                                    $amountOfParams = new Int(count($params));
                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('ViewsExtension::'.$method), $amountOfParams->int, new String(gettype($params[0])))));
                            }
                            break;
                        case 2:
                            switch(gettype($params[0])) {
                                case 'string':
                                    switch(gettype($params[1])) {
                                        case 'string':
                                            $this->Display1String2String(new String($params[0]), new String($params[1]));
                                            break;
                                        default:
                                            $amountOfParams = new Int(count($params));
                                            ErrorsExtension::throwErrorAndSaveLog($translation = new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('ViewsExtension::'.$method), $amountOfParams->int, new String(gettype($params[0])))));
                                    }
                                    break;
                                case 'array':
                                    switch(gettype($params[1])) {
                                        case 'string':
                                            $this->Display1Array2String(new Arrays($params[0]), new String($params[1]));
                                            break;
                                        default:
                                            $amountOfParams = new Int(count($params));
                                            ErrorsExtension::throwErrorAndSaveLog($translation = new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('ViewsExtension::'.$method), $amountOfParams->int, new String(gettype($params[0])))));
                                    }
                                    break;
                                default:
                                    ErrorsExtension::throwErrorAndSaveLog($translation = new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('ViewsExtension::'.$method), new String(count($params)), new String(gettype($params[0])))));
                            }
                            break;
                        case 3:
                            switch(gettype($params[0])) {
                                case 'array':
                                    switch(gettype($params[1])) {
                                        case 'string':
                                            switch(gettype($params[2])) {
                                                case 'string':
                                                    $this->Display1Array2String3String(new Arrays($params[0]), new String($params[1]), new String($params[2]));
                                                    break;
                                                default:
                                                    ErrorsExtension::throwErrorAndSaveLog($translation = new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('ViewsExtension::'.$method), new String(count($params)), new String(gettype($params[0])))));
                                            }
                                            break;
                                        default:
                                            ErrorsExtension::throwErrorAndSaveLog($translation = new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('ViewsExtension::'.$method), new String(count($params)), new String(gettype($params[0])))));
                                    }
                                    break;
                                default:
                                    ErrorsExtension::throwErrorAndSaveLog($translation = new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('ViewsExtension::'.$method), new String(count($params)), new String(gettype($params[0])))));
                            }
                            break;
                        default:
                            $amountOfParams = new Int(count($params));
                            ErrorsExtension::throwErrorAndSaveLog( new String('OVERLOAD_ERROR_INVALID_PARAMETER_AMOUNT'), new Arrays(array(new String('ViewsExtension::'.$method), $amountOfParams->int)));
                    }
                    break;
                case 'ActionLink':
                    switch(count($params)) {
                        case 2:
                            switch(gettype($params[0])) {
                                case 'string':
                                    switch(gettype($params[1])) {
                                        case 'string':
                                            return $this->ActionLink1String2String(new String($params[0]), new String($params[1]));
                                            break;
                                        default:
                                            $amountOfParams = new Int(count($params));
                                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                    }
                                    break;
                                default:
                                    $amountOfParams = new Int(count($params));
                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                            }
                            break;
                        case 3:
                            switch(gettype($params[0])) {
                                case 'string':
                                    switch(gettype($params[1])) {
                                        case 'string':
                                            switch(gettype($params[2])) {
                                                case 'string':
                                                    return $this->ActionLink1String2String3String(new String($params[0]), new String($params[1]), new String($params[2]));
                                                    break;
                                                default:
                                                    $amountOfParams = new Int(count($params));
                                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                            }
                                            break;
                                        default:
                                            $amountOfParams = new Int(count($params));
                                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                    }
                                    break;
                                default:
                                    $amountOfParams = new Int(count($params));
                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                            }
                            break;
                        case 4:
                            switch(gettype($params[0])) {
                                case 'string':
                                    switch(gettype($params[1])) {
                                        case 'string':
                                            switch(gettype($params[2])) {
                                                case 'string':
                                                    switch(gettype($params[3])) {
                                                        case 'string':
                                                            return $this->ActionLink1String2String3String4String(new String($params[0]), new String($params[1]), new String($params[2]), new String($params[3]));
                                                            break;
                                                        default:
                                                            $amountOfParams = new Int(count($params));
                                                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                                    }
                                                    break;
                                                default:
                                                    $amountOfParams = new Int(count($params));
                                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                            }
                                            break;
                                        default:
                                            $amountOfParams = new Int(count($params));
                                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                    }
                                    break;
                                default:
                                    $amountOfParams = new Int(count($params));
                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                            }
                            break;
                        case 5:
                            switch(gettype($params[0])) {
                                case 'string':
                                    switch(gettype($params[1])) {
                                        case 'string':
                                            switch(gettype($params[2])) {
                                                case 'string':
                                                    switch(gettype($params[3])) {
                                                        case 'string':
                                                            switch(gettype($params[4])) {
                                                                case 'array':
                                                                    return $this->ActionLink1String2String3String4String5Array(new String($params[0]), new String($params[1]), new String($params[2]), new String($params[3]), new Arrays(($params[4])));
                                                                    break;
                                                                default:
                                                                    $amountOfParams = new Int(count($params));
                                                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                                            }
                                                            break;
                                                        default:
                                                            $amountOfParams = new Int(count($params));
                                                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                                    }
                                                    break;
                                                default:
                                                    $amountOfParams = new Int(count($params));
                                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                            }
                                            break;
                                        default:
                                            $amountOfParams = new Int(count($params));
                                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                    }
                                    break;
                                default:
                                    $amountOfParams = new Int(count($params));
                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                            }
                            break;
                        default:
                            $amountOfParams = new Int(count($params));
                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_AMOUNT'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int)));
                    }
                    break;
                case 'HtmlLabel':
                    switch(count($params)) {
                        case 2:
                            switch(gettype($params[0])) {
                                case 'string':
                                    switch(gettype($params[1])) {
                                        case 'string':
                                            return $this->HtmlLabel1String2String(new String($params[0]), new String($params[1]));
                                            break;
                                        default:
                                            $amountOfParams = new Int(count($params));
                                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                    }
                                    break;
                                default:
                                    $amountOfParams = new Int(count($params));
                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                            }
                            break;
                        case 3:
                            switch(gettype($params[0])) {
                                case 'string':
                                    switch(gettype($params[1])) {
                                        case 'string':
                                            switch(gettype($params[2])) {
                                                case 'array':
                                                    return $this->HtmlLabel1String2String3Array(new String($params[0]), new String($params[1]), new Arrays($params[2]));
                                                    break;
                                                default:
                                                    $amountOfParams = new Int(count($params));
                                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                            }
                                            break;
                                        default:
                                            $amountOfParams = new Int(count($params));
                                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                    }
                                    break;
                                default:
                                    $amountOfParams = new Int(count($params));
                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                            }
                            break;
                        default:
                            $amountOfParams = new Int(count($params));
                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_AMOUNT'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int)));
                    }
                    break;
                case 'HtmlTextBox':
                    switch(count($params)) {
                        case 1:
                            switch(gettype($params[0])) {
                                case 'string':
                                    return $this->HtmlTextBox1String(new String($params[0]));
                                    break;
                                default:
                                    $amountOfParams = new Int(count($params));
                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('ViewsExtension::'.$method), $amountOfParams->int, new String(gettype($params[0])))));
                            }
                            break;
                        case 2:
                            switch(gettype($params[0])) {
                                case 'string':
                                    switch(gettype($params[1])) {
                                        case 'string':
                                            return $this->HtmlTextBox1String2String(new String($params[0]), new String($params[1]));
                                            break;
                                        case 'array':
                                            return $this->HtmlTextBox1String2Array(new String($params[0]), new Arrays($params[1]));
                                            break;
                                        default:
                                            $amountOfParams = new Int(count($params));
                                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                    }
                                    break;
                                default:
                                    $amountOfParams = new Int(count($params));
                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                            }
                            break;
                        case 3:
                            switch(gettype($params[0])) {
                                case 'string':
                                    switch(gettype($params[1])) {
                                        case 'string':
                                            switch(gettype($params[2])) {
                                                case 'array':
                                                    return $this->HtmlTextBox1String2String3Array(new String($params[0]), new String($params[1]), new Arrays($params[2]));
                                                    break;
                                                default:
                                                    $amountOfParams = new Int(count($params));
                                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                            }
                                            break;
                                        default:
                                            $amountOfParams = new Int(count($params));
                                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                    }
                                    break;
                                default:
                                    $amountOfParams = new Int(count($params));
                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                            }
                            break;
                        default:
                            $amountOfParams = new Int(count($params));
                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_AMOUNT'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int)));
                    }
                    break;
                case 'HtmlRadio':
                    switch(count($params)) {
                        case 3:
                            switch(gettype($params[0])) {
                                case 'string':
                                    switch(gettype($params[1])) {
                                        case 'string':
                                            switch(gettype($params[2])) {
                                                case 'string':
                                                    return $this->HtmlRadio1String2String3String(new String($params[0]), new String($params[1]), new String($params[2]));
                                                    break;
                                                default:
                                                    $amountOfParams = new Int(count($params));
                                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                            }
                                            break;
                                        default:
                                            $amountOfParams = new Int(count($params));
                                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                    }
                                    break;
                                default:
                                    $amountOfParams = new Int(count($params));
                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                            }
                            break;
                        case '4':
                            switch(gettype($params[0])) {
                                case 'string':
                                    switch(gettype($params[1])) {
                                        case 'string':
                                            switch(gettype($params[2])) {
                                                case 'string':
                                                    switch(gettype($params[3])) {
                                                        case 'array':
                                                            return $this->HtmlRadio1String2String3String4Array(new String($params[0]), new String($params[1]), new String($params[2]), new Arrays($params[3]));
                                                            break;
                                                        default:
                                                            $amountOfParams = new Int(count($params));
                                                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                                    }
                                                    break;
                                                default:
                                                    $amountOfParams = new Int(count($params));
                                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                            }
                                            break;
                                        default:
                                            $amountOfParams = new Int(count($params));
                                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                    }
                                    break;
                                default:
                                    $amountOfParams = new Int(count($params));
                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                            }
                            break;
                        default:
                            $amountOfParams = new Int(count($params));
                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_AMOUNT'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int)));
                    }
                    break;
                case 'HtmlCheckbox':
                    switch(count($params)) {
                        case 3:
                            switch(gettype($params[0])) {
                                case 'string':
                                    switch(gettype($params[1])) {
                                        case 'string':
                                            switch(gettype($params[2])) {
                                                case 'string':
                                                    return $this->HtmlCheckbox1String2String3String(new String($params[0]), new String($params[1]), new String($params[2]));
                                                    break;
                                                default:
                                                    $amountOfParams = new Int(count($params));
                                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                            }
                                            break;
                                        default:
                                            $amountOfParams = new Int(count($params));
                                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                    }
                                    break;
                                default:
                                    $amountOfParams = new Int(count($params));
                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                            }
                            break;
                        case '4':
                            switch(gettype($params[0])) {
                                case 'string':
                                    switch(gettype($params[1])) {
                                        case 'string':
                                            switch(gettype($params[2])) {
                                                case 'string':
                                                    switch(gettype($params[3])) {
                                                        case 'array':
                                                            return $this->HtmlCheckbox1String2String3String4Array(new String($params[0]), new String($params[1]), new String($params[2]), new Arrays($params[3]));
                                                            break;
                                                        default:
                                                            $amountOfParams = new Int(count($params));
                                                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                                    }
                                                    break;
                                                default:
                                                    $amountOfParams = new Int(count($params));
                                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                            }
                                            break;
                                        default:
                                            $amountOfParams = new Int(count($params));
                                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                    }
                                    break;
                                default:
                                    $amountOfParams = new Int(count($params));
                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                            }
                            break;
                        default:
                            $amountOfParams = new Int(count($params));
                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_AMOUNT'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int)));
                    }
                    break;
                case 'HtmlBeginForm':
                    switch(count($params)) {
                        case 2:
                            switch(gettype($params[0])) {
                                case 'string':
                                    switch(gettype($params[1])) {
                                        case 'string':
                                            return $this->HtmlBeginForm1String2String(new String($params[0]), new String($params[1]));
                                            break;
                                        default:
                                            $amountOfParams = new Int(count($params));
                                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                    }
                                    break;
                                default:
                                    $amountOfParams = new Int(count($params));
                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                            }
                            break;
                        case 3:
                            switch(gettype($params[0])) {
                                case 'string':
                                    switch(gettype($params[1])) {
                                        case 'string':
                                            switch(gettype($params[2])) {
                                                case 'array':
                                                    return $this->HtmlBeginForm1String2String3Array(new String($params[0]), new String($params[1]), new Arrays($params[2]));
                                                    break;
                                                default:
                                                    $amountOfParams = new Int(count($params));
                                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                            }
                                            break;
                                        default:
                                            $amountOfParams = new Int(count($params));
                                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                    }
                                    break;
                                default:
                                    $amountOfParams = new Int(count($params));
                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                            }
                            break;
                        case 4:
                            switch(gettype($params[0])) {
                                case 'string':
                                    switch(gettype($params[1])) {
                                        case 'string':
                                            switch(gettype($params[2])) {
                                                case 'array':
                                                    switch(gettype($params[3])) {
                                                        case 'boolean':
                                                            return $this->HtmlBeginForm1String2String3Array4Bool(new String($params[0]), new String($params[1]), new Arrays($params[2]), new Bool($params[3]));
                                                            break;
                                                        default:
                                                            $amountOfParams = new Int(count($params));
                                                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[3])))));
                                                    }
                                                    break;
                                                default:
                                                    $amountOfParams = new Int(count($params));
                                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                            }
                                            break;
                                        default:
                                            $amountOfParams = new Int(count($params));
                                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                                    }
                                    break;
                                default:
                                    $amountOfParams = new Int(count($params));
                                    ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_TYPE'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int, new String(gettype($params[0])))));
                            }
                            break;
                        default:
                            $amountOfParams = new Int(count($params));
                            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_INVALID_PARAMETER_AMOUNT'), new Arrays(array(new String('HtmlExtension::'.$method.'()'), $amountOfParams->int)));
                    }
                    break;
            }
		} else {
            ErrorsExtension::throwErrorAndSaveLog(new String('OVERLOAD_ERROR_NO_METHOD'), new Arrays(array(new String('ViewsExtension::'.$method))));
        }
	}

    // Display()
	private function Display1String(String $partName) {
		// Function seeks requested view in Themes directory
		// to be overwritten. If neither is found it checks
		// SafeMode theme. Ultimately function tries to load
		// a view from application /App/Templates/Layout/
		$path = new String('');

		// Paths to search into
		$currentThemePath = new String(GOTCHA_ROOT_DIR.'/Themes/'.$this->currentThemeName.'/Views/');
		$safeModeThemePath = new String(GOTCHA_ROOT_DIR.'/Themes/SafeMode/Views/');
		$appTemplatesPath = new String(GOTCHA_ROOT_DIR.'/App/Templates/Layout/');
		
		// Overwrite $partName with extension
		$partNameWithExtension = new String($partName.'.phtml');
		
		if(FileSystemExtension::CheckFileExistence($partNameWithExtension, $currentThemePath) === true) {
            $path = $currentThemePath;
		} else if(FileSystemExtension::CheckFileExistence($partNameWithExtension, $safeModeThemePath) === true) {
			$path = $safeModeThemePath;
		} else if(FileSystemExtension::CheckFileExistence($partNameWithExtension, $appTemplatesPath) === true) {
			$path = $appTemplatesPath;
        } else {
			// If we get that far, throw an error cause no view was found
            ErrorsExtension::throwErrorAndSaveLog(new String('REQUESTED_VIEW_FILE_DOESNT_EXIST'), new Arrays(array($partNameWithExtension)));
        }
		
		// There should be attached path so include requested view
		require_once $path.$partNameWithExtension;
	}

    private function Display1Array(Arrays $variables) {

    }

    private function Display1String2String(String $partName, String $moduleViewFile) {
        // Function is similar to Display1String() above but
        // additionally attaches current $moduleViewFile to a field
        $this->moduleViewFile = $moduleViewFile;

        // Call previous overload
        $this->Display1String($partName);
    }

    private function Display1Array2String(Arrays $variables, String $partName) {
        // Function allows passing set o variables to
        // a view and renders it
        $this->setVariablesForView($variables->array);
        $this->Display1String($partName);
    }

    private function Display1Array2String3String(Arrays $variables, String $partName, String $moduleViewFile) {
        // Function is similar to Display1String2String() but
        // additionally allows to pass arguments to a view
        $this->moduleViewFile = $moduleViewFile;

        $this->setVariablesForView($variables->array);
        $this->Display1String($partName);
    }

    private function Content() {
        $moduleViewFile =  $this->moduleViewFile;
        require_once $moduleViewFile;
    }

    // View helpers
    private function setStyle($styleName) {
        // Cause we already got module view file path,
        // we can use it to extract module name for
        // our search
        $styleName = new String($styleName);
        $modulePathArray = new Arrays(explode('\\', $this->moduleViewFile));

        // We search for our style in module \Styles\ directory
        // and then in theme \Styles\ directory
        if(!FileSystemExtension::CheckFileExistence($styleName, new String(GOTCHA_ROOT_DIR.'\\'.$modulePathArray->array[0].'\\'.$modulePathArray->array[1].'\Styles\\'))) {
            if(FileSystemExtension::CheckFileExistence($styleName, new String(GOTCHA_ROOT_DIR.'\Themes\\'.$this->currentThemeName.'\Styles\\'))) {
                return new String('<link rel="stylesheet" type="text/css" href="'.GOTCHA_BASE_PATH.'/Themes/'.$this->currentThemeName.'/Styles/'.$styleName.'">');
            } else {
                ErrorsExtension::throwErrorAndSaveLog(new String('REQUESTED_CSS_FILE_DOESNT_EXIST'), new Arrays(array(GOTCHA_ROOT_DIR.'\Themes\\'.$this->currentThemeName.'\Styles\\'.$styleName)));
            }
        } else {
            return new String('<link rel="stylesheet" type="text/css" href="'.GOTCHA_BASE_PATH.'/'.$modulePathArray->array[0].'/'.$modulePathArray->array[1].'/Styles/'.$styleName.'">');
        }

        return null;
    }

    private function setScript($scriptName) {
        // Cause we already got module view file path,
        // we can use it to extract module name for
        // our search
        $scriptName = new String($scriptName);
        $modulePathArray = new Arrays(explode('\\', $this->moduleViewFile));

        // We search for our style in module \Styles\ directory
        // and then in theme \Styles\ directory
        if(!FileSystemExtension::CheckFileExistence($scriptName, new String(GOTCHA_ROOT_DIR.'\\'.$modulePathArray->array[0].'\\'.$modulePathArray->array[1].'\Scripts\\'))) {
            if(FileSystemExtension::CheckFileExistence($scriptName, new String(GOTCHA_ROOT_DIR.'\Themes\\'.$this->currentThemeName.'\Scripts\\'))) {
                return new String('<script src="'.GOTCHA_BASE_PATH.'/Themes/'.$this->currentThemeName.'/Scripts/'.$scriptName.'"></script>');
            } else {
                ErrorsExtension::throwErrorAndSaveLog(new String('REQUESTED_CSS_FILE_DOESNT_EXIST'), new Arrays(array(GOTCHA_ROOT_DIR.'\Themes\\'.$this->currentThemeName.'\Scripts\\'.$scriptName)));
            }
        } else {
            return new String('<script src="'.GOTCHA_BASE_PATH.'/'.$modulePathArray->array[0].'/'.$modulePathArray->array[1].'/Scripts/'.$scriptName.'"></script>');
        }

        return null;
    }

    private function setVariablesForView(array $variables) {
        foreach($variables as $variableKey => $variable) {
            $this->$variableKey = $variable;
        }
    }
}